include_directories(
    ..
    ../codegenerators
    ../codeimpwizard
    ../debug
    ../umlmodel
    ../umlwidgets
    ../dialogs
    ../dialogs
    ../../lib/cppparser/
    ../../lib/interfaces/
)

set(libcodeimport_SRCS
    adaimport.cpp
    classimport.cpp
    cppimport.cpp
    csvalaimportbase.cpp
    idlimport.cpp
    import_utils.cpp
    javacsvalaimportbase.cpp
    javaimport.cpp
    nativeimportbase.cpp
    pascalimport.cpp
    pythonimport.cpp
    sqlimport.cpp
    csharp/csharpimport.cpp
    vala/valaimport.cpp
)

if(BUILD_PHP_IMPORT)
    list(APPEND libcodeimport_SRCS
        phpimport.cpp
    )
endif()

set(libkdevcppparser_SRCS
    ${CMAKE_SOURCE_DIR}/lib/cppparser/ast.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/ast_utils.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/cachemanager.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/driver.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/errors.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/lexer.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/lexercache.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/lookup.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/parser.cpp
    ${CMAKE_SOURCE_DIR}/lib/cppparser/tree_parser.cpp
    ${CMAKE_SOURCE_DIR}/lib/interfaces/hashedstring.cpp
    kdevcppparser/cpptree2uml.cpp
)

add_library(codeimport STATIC ${libcodeimport_SRCS} ${libkdevcppparser_SRCS})
target_link_libraries(codeimport
    Qt5::Widgets
    Qt5::Xml
    KF5::CoreAddons
    KF5::I18n
    KF5::IconThemes
    KF5::KIOCore
    KF5::TextEditor
    KF5::WidgetsAddons
    KF5::XmlGui
    KF5::Crash
)
if(BUILD_PHP_IMPORT)
    target_link_libraries(codeimport
        KDev::Interfaces
        KDev::Language
        KDev::Tests
        kdevphpparser
    )
endif()

target_include_directories(codeimport
    PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/csharp
    ${CMAKE_CURRENT_SOURCE_DIR}/vala
)
